#include "Menu.h"
#include "MenuSolo.h"
#include "MenuMultijugador.h"
#include "MenuConectar.h"
#include <string>
#include <iostream>

Menu::Menu()
{
	Glib::RefPtr<Gtk::Builder> refBuilder = Gtk::Builder::create();
	refBuilder->add_from_file("./Cliente/Menu.glade");

	refBuilder->get_widget("Menu", main);
	
	refBuilder->get_widget("JugarSolo", botonSolo);
	botonSolo->signal_clicked().connect(sigc::mem_fun(*this, &Menu::on_buttonSolo_clicked));

	refBuilder->get_widget("JugarMultijugador", botonMulti);
	botonMulti->signal_clicked().connect(sigc::mem_fun(*this, &Menu::on_buttonMulti_clicked));

	refBuilder->get_widget("Salir", Salir);
	Salir->signal_clicked().connect(sigc::mem_fun(*this, &Menu::on_buttonSalir_clicked));
	
	main->show_all_children();
}

void Menu::correr() {
	Gtk::Main::run(*main);
}

Menu::~Menu()
{
}

void Menu::on_buttonSolo_clicked() {
	main->hide();
	MainJuegoLocal m;
	MenuSolo menuSolo(&m);
	menuSolo.correr();
	correr();
}
void Menu::on_buttonMulti_clicked(){
	main->hide();
	MenuConectar m;
	m.correr();
	correr();
}
void Menu::on_buttonSalir_clicked(){
	Gtk::Main::quit();
}
